<!doctype html>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">

	<head>
		<title>开发文档</title>
	</head>
	<link rel="stylesheet" type="text/css" href="https://cdn.bootcss.com/KaTeX/0.7.1/katex.min.css">
	<link rel="stylesheet" type="text/css"
		href="https://cdn.jsdelivr.net/gh/pandao/editor.md@1.5.0/css/editormd.min.css">
	<style type="text/css">
		body {
			font-family: "Helvetica Neue", "Helvetica", "Microsoft Yahei", "微软雅黑", "Lantinghei SC", "STXihei", "WenQuanYi Micro Hei", Arial, sans-serif;
			text-align: justify;
			margin: auto;
			font-size: 14px;
			line-height: 1.6em;
			color: #333;
			background: #fefefe;
			padding: 15px;
			margin: 30px auto;
			position: relative;
			-webkit-font-smoothing: antialiased;
			font-smoothing: antialiased;
		}

		article,
		footer,
		header,
		nav {
			margin: 0 auto
		}

		article {
			margin-top: 4em;
			margin-bottom: 4em;
			min-height: 400px
		}

		footer {
			margin-bottom: 50px
		}

		video {
			margin: 2em 0;
			border: 1px solid #ddd
		}

		nav {
			font-size: .9em;
			font-style: italic;
			border-bottom: 1px solid #ddd;
			padding: 1em 0
		}

		nav p {
			margin: 0
		}

		details {
			margin: 15px 0;
		}

		summary {
			cursor: pointer;
			padding: 4px;
		}

		summary:focus {
			outline: none;
			box-shadow: 0 0 3px #2196F3;
		}

		.h1,
		h1 {
			font-size: 2.2em;
		}

		.h2,
		h2 {
			font-size: 1.9em;
		}

		.h3,
		h3 {
			font-size: 1.6em;
		}

		.h4,
		h4 {
			font-size: 1.3em;
		}

		.h5,
		h5 {
			font-size: 1.2em;
		}

		.h6,
		h6 {
			font-size: 1.1em;
		}

		.h1,
		.h2,
		.h3,
		.h4,
		.h5,
		.h6,
		h1,
		h2,
		h3,
		h4,
		h5,
		h6 {
			font-family: inherit;
			font-weight: 500;
			color: #333;
			line-height: 1.2em;
			padding: 0.3em 0;
			margin: 0.8em 0 0.4em 0;
			word-break: break-all;
		}

		.h1,
		h1 {
			letter-spacing: 1px;
			border-bottom: 1px solid #ddd;
		}

		.h2,
		h2 {
			padding-bottom: 0.15em;
		}

		p {
			-webkit-hypens: auto;
			-moz-hypens: auto;
			hyphens: auto;
			margin: 10px 0;
		}

		p,
		li,
		div,
		ul {
			word-wrap: break-all;
		}

		blockquote {
			margin-left: 1em;
			padding: 10px 15px;
			margin: 10px 0 20px 0;
			border-left: 10px solid #ddd;
			background: #f6f6f6;
		}

		blockquote p {
			margin: 0;
			font-weight: 400;
		}

		pre {
			display: block;
			padding: 0;
			overflow: auto;
			margin: 0 0 10px;
			font-size: 1em;
			line-height: 1.42857143;
			word-break: break-all;
			word-wrap: break-word;
			color: #333;
			background: none;
			border-radius: 4px
		}

		code,
		kbd,
		pre,
		samp {
			font-family: Consolas, 'Liberation Mono', 'Ubuntu Mono', Menlo, Courier, sans-serif;
		}

		a {
			color: #1980e6;
			text-decoration: none
		}

		a:hover {
			text-decoration: underline
		}

		a img {
			border: none
		}

		img {
			max-width: 100%;
		}

		h1 a,
		h1 a:hover {
			text-decoration: none
		}

		hr {
			border: 0 none;
			height: 4px;
			margin: 1.2em 0;
			background: rgba(0, 0, 0, 0) url() repeat-x 0 0;
		}

		@media screen and (min-width: 900px) {
			body {
				width: 900px;
			}
		}

		ul,
		ol {
			padding: 0.2em 0 0.2em 2em;
		}

		table {
			border-collapse: collapse;
			border-spacing: 0;
			margin-bottom: 20px;
		}

		table thead {
			background: #eee;
		}

		table td,
		table th {
			padding: .5em;
			border: 1px solid #ddd;
			line-height: 1.5;
		}

		.markdown-flow {
			background: #fff;
			padding: 15px;
		}

		.markdown-flow .label {
			color: #444;
		}

		.markdown-latex {
			text-align: center;
			font-size: 1.3em;
			color: #000;
			margin-bottom: 1.5em;
			overflow: hidden;
			overflow-x: auto;
		}

		.latex-inline .katex-display {
			display: inline-block;
			font-size: 0.8em;
		}

		.markdown-menu ul {
			padding: 0 10px 20px 20px;
		}

		.markdown-menu li {
			font-size: 14px;
			list-style: none;
			line-height: 1.8em;
			overflow: hidden;
			text-overflow: ellipsis;
			white-space: nowrap;
		}

		.markdown-menu-h2 {
			padding-left: 2em;
		}

		.markdown-menu-h3 {
			padding-left: 4em;
		}

		.markdown-menu-h4 {
			padding-left: 6em;
		}

		.markdown-menu-h5 {
			padding-left: 8em;
		}

		.markdown-menu-h6 {
			padding-left: 10em;
		}

		.print-btn {
			position: absolute;
			padding: 4px 20px;
			color: #444;
			font-size: 1em;
			background: #eee;
			background: rgba(200, 200, 200, 0.2);
			margin-top: -45px;
			right: 15px;
		}

		.print-btn:hover {
			text-decoration: none;
			background: #14a2ff;
			color: #fff;
		}

		.hidden {
			display: none !important;
		}

		/*打印样式*/
		@media print {
			body {
				padding: 0 1.5cm;
				margin: 0 auto 10px auto;
				font-size: 13px;
			}

			.print-btn {
				display: none;
			}
		}

		ol.linenums {
			padding-left: 2.5em;
		}

		ol.linenums li {
			list-style-type: decimal !important;
		}
	</style>

<body>
	<!-- <a href="javascript:window.print();" class="print-btn">打印(Print)</a> -->
	<!-- MarkDown Content -->

	<h3 id="toc2"><a name="协议规则" class="reference-link"></a><span
			class="header-link octicon octicon-link"></span>协议规则</h3>
	<p>请求数据格式：application/x-www-form-urlencode</p>
	<p>返回数据格式：JSON</p>
	<p>签名算法：MD5</p>
	<p>字符编码：UTF-8</p>
	<h3 id="pay0"><a name="页面跳转支付" class="reference-link"></a><span
			class="header-link octicon octicon-link"></span>页面跳转支付</h3>
	<p>此接口可用于用户前台直接发起支付，使用form表单跳转或拼接成url跳转。</p>
	<p>URL地址：<a href="javascript:void(0);"><?php echo $domain ?>/submit.php</a></p>
	<p>请求方式：POST 或 GET（推荐POST，不容易被劫持或屏蔽）</p>
	<p>请求参数说明：</p>
	<table>
		<thead>
			<tr>
				<th>字段名</th>
				<th>变量名</th>
				<th>必填</th>
				<th>类型</th>
				<th>示例值</th>
				<th>描述</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td>商户ID</td>
				<td>pid</td>
				<td>是</td>
				<td>Int</td>
				<td>1001</td>
				<td></td>
			</tr>
			<tr>
				<td>支付方式</td>
				<td>type</td>
				<td>否</td>
				<td>String</td>
				<td>alipay</td>
				<td><a href="#pay4">支付方式列表</a></td>
			</tr>
			<tr>
				<td>商户订单号</td>
				<td>out_trade_no</td>
				<td>是</td>
				<td>String</td>
				<td>20160806151343349</td>
				<td></td>
			</tr>
			<tr>
				<td>异步通知地址</td>
				<td>notify_url</td>
				<td>是</td>
				<td>String</td>
				<td><a href="javascript:void(0);">http://www.pay.com/notify_url.php</a></td>
				<td>服务器异步通知地址</td>
			</tr>
			<tr>
				<td>跳转通知地址</td>
				<td>return_url</td>
				<td>是</td>
				<td>String</td>
				<td><a href="javascript:void(0);">http://www.pay.com/return_url.php</a></td>
				<td>页面跳转通知地址</td>
			</tr>
			<tr>
				<td>商品名称</td>
				<td>name</td>
				<td>是</td>
				<td>String</td>
				<td>VIP会员</td>
				<td>如超过127个字节会自动截取</td>
			</tr>
			<tr>
				<td>商品金额</td>
				<td>money</td>
				<td>是</td>
				<td>String</td>
				<td>1.00</td>
				<td>单位：元，最大2位小数</td>
			</tr>
			<tr>
				<td>业务扩展参数</td>
				<td>param</td>
				<td>否</td>
				<td>String</td>
				<td>没有请留空</td>
				<td>支付后原样返回</td>
			</tr>
			<tr>
				<td>签名字符串</td>
				<td>sign</td>
				<td>是</td>
				<td>String</td>
				<td>202cb962ac59075b964b07152d234b70</td>
				<td>签名算法<a href="#pay3">点此查看</a></td>
			</tr>
			<tr>
				<td>签名类型</td>
				<td>sign_type</td>
				<td>是</td>
				<td>String</td>
				<td>MD5</td>
				<td>默认为MD5</td>
			</tr>
		</tbody>
	</table>
	<p>支付方式（type）不传会跳转到收银台支付</p>
	<h3 id="pay1"><a name="API接口支付" class="reference-link"></a><span
			class="header-link octicon octicon-link"></span>API接口支付</h3>
	<p>此接口可用于服务器后端发起支付请求，会返回支付二维码链接或支付跳转url。</p>
	<p>URL地址：<a href="javascript:void(0);"><?php echo $domain ?>/mapi.php</a></p>
	<p>请求方式：POST</p>
	<p>请求参数说明：</p>
	<table>
		<thead>
			<tr>
				<th>字段名</th>
				<th>变量名</th>
				<th>必填</th>
				<th>类型</th>
				<th>示例值</th>
				<th>描述</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td>商户ID</td>
				<td>pid</td>
				<td>是</td>
				<td>Int</td>
				<td>1001</td>
				<td></td>
			</tr>
			<tr>
				<td>支付方式</td>
				<td>type</td>
				<td>是</td>
				<td>String</td>
				<td>alipay</td>
				<td><a href="#pay4">支付方式列表</a></td>
			</tr>
			<tr>
				<td>商户订单号</td>
				<td>out_trade_no</td>
				<td>是</td>
				<td>String</td>
				<td>20160806151343349</td>
				<td></td>
			</tr>
			<tr>
				<td>异步通知地址</td>
				<td>notify_url</td>
				<td>是</td>
				<td>String</td>
				<td><a href="javascript:void(0);">http://www.pay.com/notify_url.php</a></td>
				<td>服务器异步通知地址</td>
			</tr>
			<tr>
				<td>跳转通知地址</td>
				<td>return_url</td>
				<td>否</td>
				<td>String</td>
				<td><a href="javascript:void(0);">http://www.pay.com/return_url.php</a></td>
				<td>页面跳转通知地址</td>
			</tr>
			<tr>
				<td>商品名称</td>
				<td>name</td>
				<td>是</td>
				<td>String</td>
				<td>VIP会员</td>
				<td>如超过127个字节会自动截取</td>
			</tr>
			<tr>
				<td>商品金额</td>
				<td>money</td>
				<td>是</td>
				<td>String</td>
				<td>1.00</td>
				<td>单位：元，最大2位小数</td>
			</tr>
			<tr>
				<td>用户IP地址</td>
				<td>clientip</td>
				<td>是</td>
				<td>String</td>
				<td>192.168.1.100</td>
				<td>用户发起支付的IP地址</td>
			</tr>
			<tr>
				<td>设备类型</td>
				<td>device</td>
				<td>否</td>
				<td>String</td>
				<td>pc</td>
				<td>根据当前用户浏览器的UA判断，传入用户所使用的浏览器或设备类型，默认为pc<a href="#pay5">设备类型列表</a></td>
			</tr>
			<tr>
				<td>业务扩展参数</td>
				<td>param</td>
				<td>否</td>
				<td>String</td>
				<td>没有请留空</td>
				<td>支付后原样返回</td>
			</tr>
			<tr>
				<td>签名字符串</td>
				<td>sign</td>
				<td>是</td>
				<td>String</td>
				<td>202cb962ac59075b964b07152d234b70</td>
				<td>签名算法<a href="#pay3">点此查看</a></td>
			</tr>
			<tr>
				<td>签名类型</td>
				<td>sign_type</td>
				<td>是</td>
				<td>String</td>
				<td>MD5</td>
				<td>默认为MD5</td>
			</tr>
		</tbody>
	</table>
	<p>返回结果（json）：</p>
	<table>
		<thead>
			<tr>
				<th>字段名</th>
				<th>变量名</th>
				<th>类型</th>
				<th>示例值</th>
				<th>描述</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td>返回状态码</td>
				<td>code</td>
				<td>Int</td>
				<td>1</td>
				<td>1为成功，其它值为失败</td>
			</tr>
			<tr>
				<td>返回信息</td>
				<td>msg</td>
				<td>String</td>
				<td></td>
				<td>失败时返回原因</td>
			</tr>
			<tr>
				<td>订单号</td>
				<td>trade_no</td>
				<td>String</td>
				<td>20160806151343349</td>
				<td>支付订单号</td>
			</tr>
			<tr>
				<td>支付跳转url</td>
				<td>payurl</td>
				<td>String</td>
				<td><a
						href="javascript:void(0);"><?php echo $domain ?>/pay/wxpay/202010903/</a>
				</td>
				<td>如果返回该字段，则直接跳转到该url支付</td>
			</tr>
			<tr>
				<td>二维码链接</td>
				<td>qrcode</td>
				<td>String</td>
				<td>weixin://wxpay/bizpayurl?pr=04IPMKM</td>
				<td>如果返回该字段，则根据该url生成二维码</td>
			</tr>
			<tr>
				<td>小程序跳转url</td>
				<td>urlscheme</td>
				<td>String</td>
				<td>weixin://dl/business/?ticket=xxx</td>
				<td>如果返回该字段，则使用js跳转该url，可发起微信小程序支付</td>
			</tr>
		</tbody>
	</table>
	<p>注：payurl、qrcode、urlscheme 三个参数只会返回其中一个</p>
	<h3 id="pay2"><a name="支付结果通知" class="reference-link"></a><span
			class="header-link octicon octicon-link"></span>支付结果通知</h3>
	<p>通知类型：服务器异步通知（notify_url）、页面跳转通知（return_url）</p>
	<p>请求方式：GET</p>
	<p>请求参数说明：</p>
	<table>
		<thead>
			<tr>
				<th>字段名</th>
				<th>变量名</th>
				<th>必填</th>
				<th>类型</th>
				<th>示例值</th>
				<th>描述</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td>商户ID</td>
				<td>pid</td>
				<td>是</td>
				<td>Int</td>
				<td>1001</td>
				<td></td>
			</tr>
			<tr>
				<td>易支付订单号</td>
				<td>trade_no</td>
				<td>是</td>
				<td>String</td>
				<td>20160806151343349021</td>
				<td>聚合易支付订单号</td>
			</tr>
			<tr>
				<td>商户订单号</td>
				<td>out_trade_no</td>
				<td>是</td>
				<td>String</td>
				<td>20160806151343349</td>
				<td>商户系统内部的订单号</td>
			</tr>
			<tr>
				<td>支付方式</td>
				<td>type</td>
				<td>是</td>
				<td>String</td>
				<td>alipay</td>
				<td><a href="#pay4">支付方式列表</a></td>
			</tr>
			<tr>
				<td>商品名称</td>
				<td>name</td>
				<td>是</td>
				<td>String</td>
				<td>VIP会员</td>
				<td></td>
			</tr>
			<tr>
				<td>商品金额</td>
				<td>money</td>
				<td>是</td>
				<td>String</td>
				<td>1.00</td>
				<td></td>
			</tr>
			<tr>
				<td>支付状态</td>
				<td>trade_status</td>
				<td>是</td>
				<td>String</td>
				<td>TRADE_SUCCESS</td>
				<td>只有TRADE_SUCCESS是成功</td>
			</tr>
			<tr>
				<td>业务扩展参数</td>
				<td>param</td>
				<td>否</td>
				<td>String</td>
				<td></td>
				<td></td>
			</tr>
			<tr>
				<td>签名字符串</td>
				<td>sign</td>
				<td>是</td>
				<td>String</td>
				<td>202cb962ac59075b964b07152d234b70</td>
				<td>签名算法<a href="#pay3">点此查看</a></td>
			</tr>
			<tr>
				<td>签名类型</td>
				<td>sign_type</td>
				<td>是</td>
				<td>String</td>
				<td>MD5</td>
				<td>默认为MD5</td>
			</tr>
		</tbody>
	</table>
	<p>收到异步通知后，需返回success以表示服务器接收到了订单通知</p>
	<h3 id="pay3"><a name="MD5签名算法" class="reference-link"></a><span
			class="header-link octicon octicon-link"></span>MD5签名算法</h3>
	<p>1、将发送或接收到的所有参数按照参数名ASCII码从小到大排序（a-z），sign、sign_type、和空值不参与签名！</p>
	<p>2、将排序后的参数拼接成URL键值对的格式，例如 <code>a=b&amp;c=d&amp;e=f</code>，参数值不要进行url编码。</p>
	<p>3、再将拼接好的字符串与商户密钥KEY进行MD5加密得出sign签名参数，<code>sign = md5 ( a=b&amp;c=d&amp;e=f + KEY )</code> （注意：+
		为各语言的拼接符，不是字符！），md5结果为小写。</p>
	<p>4、具体签名与发起支付的示例代码可下载SDK查看。</p>
	<h3 id="pay4"><a name="支付方式列表" class="reference-link"></a><span
			class="header-link octicon octicon-link"></span>支付方式列表</h3>
	<table>
		<thead>
			<tr>
				<th>调用值</th>
				<th>描述</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td>alipay</td>
				<td>支付宝</td>
			</tr>
			<tr>
				<td>wxpay</td>
				<td>微信支付</td>
			</tr>
		</tbody>
	</table>
	<h3 id="pay5"><a name="设备类型列表" class="reference-link"></a><span
			class="header-link octicon octicon-link"></span>设备类型列表</h3>
	<table>
		<thead>
			<tr>
				<th>调用值</th>
				<th>描述</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td>pc</td>
				<td>电脑浏览器</td>
			</tr>
			<tr>
				<td>mobile</td>
				<td>手机浏览器</td>
			</tr>
			<tr>
				<td>qq</td>
				<td>手机QQ内浏览器</td>
			</tr>
			<tr>
				<td>wechat</td>
				<td>微信内浏览器</td>
			</tr>
			<tr>
				<td>alipay</td>
				<td>支付宝客户端</td>
			</tr>
		</tbody>
	</table>
	<hr>
	<h3 id="api1"><a name="[API]查询商户信息" class="reference-link"></a><span
			class="header-link octicon octicon-link"></span>[API]查询商户信息</h3>
	<p>URL地址：<a
			href="javascript:void(0);"><?php echo $domain ?>/api.php?act=query&amp;pid={商户ID}&amp;key={商户密钥}</a>
	</p>
	<p>请求参数说明：</p>
	<table>
		<thead>
			<tr>
				<th>字段名</th>
				<th>变量名</th>
				<th>必填</th>
				<th>类型</th>
				<th>示例值</th>
				<th>描述</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td>操作类型</td>
				<td>act</td>
				<td>是</td>
				<td>String</td>
				<td>query</td>
				<td>此API固定值</td>
			</tr>
			<tr>
				<td>商户ID</td>
				<td>pid</td>
				<td>是</td>
				<td>Int</td>
				<td>1001</td>
				<td></td>
			</tr>
			<tr>
				<td>商户密钥</td>
				<td>key</td>
				<td>是</td>
				<td>String</td>
				<td>89unJUB8HZ54Hj7x4nUj56HN4nUzUJ8i</td>
				<td></td>
			</tr>
		</tbody>
	</table>
	<p>返回结果：</p>
	<table>
		<thead>
			<tr>
				<th>字段名</th>
				<th>变量名</th>
				<th>类型</th>
				<th>示例值</th>
				<th>描述</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td>返回状态码</td>
				<td>code</td>
				<td>Int</td>
				<td>1</td>
				<td>1为成功，其它值为失败</td>
			</tr>
			<tr>
				<td>商户ID</td>
				<td>pid</td>
				<td>Int</td>
				<td>1001</td>
				<td>商户ID</td>
			</tr>
			<tr>
				<td>商户密钥</td>
				<td>key</td>
				<td>String(32)</td>
				<td>89unJUB8HZ54Hj7x4nUj56HN4nUzUJ8i</td>
				<td>商户密钥</td>
			</tr>
			<tr>
				<td>商户状态</td>
				<td>active</td>
				<td>Int</td>
				<td>1</td>
				<td>1为正常，0为封禁</td>
			</tr>
			<tr>
				<td>商户余额</td>
				<td>money</td>
				<td>String</td>
				<td>0.00</td>
				<td>商户所拥有的余额</td>
			</tr>
			<tr>
				<td>结算方式</td>
				<td>type</td>
				<td>Int</td>
				<td>1</td>
				<td>1:支付宝,2:微信,3:QQ,4:银行卡</td>
			</tr>
			<tr>
				<td>结算账号</td>
				<td>account</td>
				<td>String</td>
				<td><a href="javascript:void(0);">admin@pay.com</a></td>
				<td>结算的支付宝账号</td>
			</tr>
			<tr>
				<td>结算姓名</td>
				<td>username</td>
				<td>String</td>
				<td>张三</td>
				<td>结算的支付宝姓名</td>
			</tr>
			<tr>
				<td>订单总数</td>
				<td>orders</td>
				<td>Int</td>
				<td>30</td>
				<td>订单总数统计</td>
			</tr>
			<tr>
				<td>今日订单</td>
				<td>order_today</td>
				<td>Int</td>
				<td>15</td>
				<td>今日订单数量</td>
			</tr>
			<tr>
				<td>昨日订单</td>
				<td>order_lastday</td>
				<td>Int</td>
				<td>15</td>
				<td>昨日订单数量</td>
			</tr>
		</tbody>
	</table>
	<h3 id="api2"><a name="[API]查询结算记录" class="reference-link"></a><span
			class="header-link octicon octicon-link"></span>[API]查询结算记录</h3>
	<p>URL地址：<a
			href="javascript:void(0);"><?php echo $domain ?>/api.php?act=settle&amp;pid={商户ID}&amp;key={商户密钥}</a>
	</p>
	<p>请求参数说明：</p>
	<table>
		<thead>
			<tr>
				<th>字段名</th>
				<th>变量名</th>
				<th>必填</th>
				<th>类型</th>
				<th>示例值</th>
				<th>描述</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td>操作类型</td>
				<td>act</td>
				<td>是</td>
				<td>String</td>
				<td>settle</td>
				<td>此API固定值</td>
			</tr>
			<tr>
				<td>商户ID</td>
				<td>pid</td>
				<td>是</td>
				<td>Int</td>
				<td>1001</td>
				<td></td>
			</tr>
			<tr>
				<td>商户密钥</td>
				<td>key</td>
				<td>是</td>
				<td>String</td>
				<td>89unJUB8HZ54Hj7x4nUj56HN4nUzUJ8i</td>
				<td></td>
			</tr>
		</tbody>
	</table>
	<p>返回结果：</p>
	<table>
		<thead>
			<tr>
				<th>字段名</th>
				<th>变量名</th>
				<th>类型</th>
				<th>示例值</th>
				<th>描述</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td>返回状态码</td>
				<td>code</td>
				<td>Int</td>
				<td>1</td>
				<td>1为成功，其它值为失败</td>
			</tr>
			<tr>
				<td>返回信息</td>
				<td>msg</td>
				<td>String</td>
				<td>查询结算记录成功！</td>
				<td></td>
			</tr>
			<tr>
				<td>结算记录</td>
				<td>data</td>
				<td>Array</td>
				<td>结算记录列表</td>
				<td></td>
			</tr>
		</tbody>
	</table>
	<h3 id="api3"><a name="[API]查询单个订单" class="reference-link"></a><span
			class="header-link octicon octicon-link"></span>[API]查询单个订单</h3>
	<p>URL地址：<a
			href="javascript:void(0);"><?php echo $domain ?>/api.php?act=order&amp;pid={商户ID}&amp;key={商户密钥}&amp;out_trade_no={商户订单号}</a>
	</p>
	<p>请求参数说明：</p>
	<table>
		<thead>
			<tr>
				<th>字段名</th>
				<th>变量名</th>
				<th>必填</th>
				<th>类型</th>
				<th>示例值</th>
				<th>描述</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td>操作类型</td>
				<td>act</td>
				<td>是</td>
				<td>String</td>
				<td>order</td>
				<td>此API固定值</td>
			</tr>
			<tr>
				<td>商户ID</td>
				<td>pid</td>
				<td>是</td>
				<td>Int</td>
				<td>1001</td>
				<td></td>
			</tr>
			<tr>
				<td>商户密钥</td>
				<td>key</td>
				<td>是</td>
				<td>String</td>
				<td>89unJUB8HZ54Hj7x4nUj56HN4nUzUJ8i</td>
				<td></td>
			</tr>
			<tr>
				<td>系统订单号</td>
				<td>trade_no</td>
				<td>选择</td>
				<td>String</td>
				<td>20160806151343312</td>
				<td></td>
			</tr>
			<tr>
				<td>商户订单号</td>
				<td>out_trade_no</td>
				<td>选择</td>
				<td>String</td>
				<td>20160806151343349</td>
				<td></td>
			</tr>
		</tbody>
	</table>
	<p>提示：系统订单号 和 商户订单号 二选一传入即可，如果都传入以系统订单号为准！</p>
	<p>返回结果：</p>
	<table>
		<thead>
			<tr>
				<th>字段名</th>
				<th>变量名</th>
				<th>类型</th>
				<th>示例值</th>
				<th>描述</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td>返回状态码</td>
				<td>code</td>
				<td>Int</td>
				<td>1</td>
				<td>1为成功，其它值为失败</td>
			</tr>
			<tr>
				<td>返回信息</td>
				<td>msg</td>
				<td>String</td>
				<td>查询订单号成功！</td>
				<td></td>
			</tr>
			<tr>
				<td>易支付订单号</td>
				<td>trade_no</td>
				<td>String</td>
				<td>2016080622555342651</td>
				<td>聚合易支付订单号</td>
			</tr>
			<tr>
				<td>商户订单号</td>
				<td>out_trade_no</td>
				<td>String</td>
				<td>20160806151343349</td>
				<td>商户系统内部的订单号</td>
			</tr>
			<tr>
				<td>第三方订单号</td>
				<td>api_trade_no</td>
				<td>String</td>
				<td>20160806151343349</td>
				<td>支付宝微信等接口方订单号</td>
			</tr>
			<tr>
				<td>支付方式</td>
				<td>type</td>
				<td>String</td>
				<td>alipay</td>
				<td><a href="#pay4">支付方式列表</a></td>
			</tr>
			<tr>
				<td>商户ID</td>
				<td>pid</td>
				<td>Int</td>
				<td>1001</td>
				<td>发起支付的商户ID</td>
			</tr>
			<tr>
				<td>创建订单时间</td>
				<td>addtime</td>
				<td>String</td>
				<td>2016-08-06 22:55:52</td>
				<td></td>
			</tr>
			<tr>
				<td>完成交易时间</td>
				<td>endtime</td>
				<td>String</td>
				<td>2016-08-06 22:55:52</td>
				<td></td>
			</tr>
			<tr>
				<td>商品名称</td>
				<td>name</td>
				<td>String</td>
				<td>VIP会员</td>
				<td></td>
			</tr>
			<tr>
				<td>商品金额</td>
				<td>money</td>
				<td>String</td>
				<td>1.00</td>
				<td></td>
			</tr>
			<tr>
				<td>支付状态</td>
				<td>status</td>
				<td>Int</td>
				<td>0</td>
				<td>1为支付成功，0为未支付</td>
			</tr>
			<tr>
				<td>业务扩展参数</td>
				<td>param</td>
				<td>String</td>
				<td></td>
				<td>默认留空</td>
			</tr>
			<tr>
				<td>支付者账号</td>
				<td>buyer</td>
				<td>String</td>
				<td></td>
				<td>默认留空</td>
			</tr>
		</tbody>
	</table>
	<h3 id="api4"><a name="[API]批量查询订单" class="reference-link"></a><span
			class="header-link octicon octicon-link"></span>[API]批量查询订单</h3>
	<p>URL地址：<a
			href="javascript:void(0);"><?php echo $domain ?>/api.php?act=orders&amp;pid={商户ID}&amp;key={商户密钥}</a>
	</p>
	<p>请求参数说明：</p>
	<table>
		<thead>
			<tr>
				<th>字段名</th>
				<th>变量名</th>
				<th>必填</th>
				<th>类型</th>
				<th>示例值</th>
				<th>描述</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td>操作类型</td>
				<td>act</td>
				<td>是</td>
				<td>String</td>
				<td>orders</td>
				<td>此API固定值</td>
			</tr>
			<tr>
				<td>商户ID</td>
				<td>pid</td>
				<td>是</td>
				<td>Int</td>
				<td>1001</td>
				<td></td>
			</tr>
			<tr>
				<td>商户密钥</td>
				<td>key</td>
				<td>是</td>
				<td>String</td>
				<td>89unJUB8HZ54Hj7x4nUj56HN4nUzUJ8i</td>
				<td></td>
			</tr>
			<tr>
				<td>查询订单数量</td>
				<td>limit</td>
				<td>否</td>
				<td>Int</td>
				<td>20</td>
				<td>返回的订单数量，最大50</td>
			</tr>
			<tr>
				<td>页码</td>
				<td>page</td>
				<td>否</td>
				<td>Int</td>
				<td>1</td>
				<td>当前查询的页码</td>
			</tr>
		</tbody>
	</table>
	<p>返回结果：</p>
	<table>
		<thead>
			<tr>
				<th>字段名</th>
				<th>变量名</th>
				<th>类型</th>
				<th>示例值</th>
				<th>描述</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td>返回状态码</td>
				<td>code</td>
				<td>Int</td>
				<td>1</td>
				<td>1为成功，其它值为失败</td>
			</tr>
			<tr>
				<td>返回信息</td>
				<td>msg</td>
				<td>String</td>
				<td>查询结算记录成功！</td>
				<td></td>
			</tr>
			<tr>
				<td>订单列表</td>
				<td>data</td>
				<td>Array</td>
				<td></td>
				<td>订单列表</td>
			</tr>
		</tbody>
	</table>
	<h3 id="api5"><a name="[API]提交订单退款" class="reference-link"></a><span
			class="header-link octicon octicon-link"></span>[API]提交订单退款</h3>
	<p>需要先在商户后台开启订单退款API接口开关，才能调用该接口发起订单退款</p>
	<p>URL地址：<a href="javascript:void(0);"><?php echo $domain ?>/api.php?act=refund</a></p>
	<p>请求方式：POST</p>
	<p>请求参数说明：</p>
	<table>
		<thead>
			<tr>
				<th>字段名</th>
				<th>变量名</th>
				<th>必填</th>
				<th>类型</th>
				<th>示例值</th>
				<th>描述</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td>商户ID</td>
				<td>pid</td>
				<td>是</td>
				<td>Int</td>
				<td>1001</td>
				<td></td>
			</tr>
			<tr>
				<td>商户密钥</td>
				<td>key</td>
				<td>是</td>
				<td>String</td>
				<td>89unJUB8HZ54Hj7x4nUj56HN4nUzUJ8i</td>
				<td></td>
			</tr>
			<tr>
				<td>易支付订单号</td>
				<td>trade_no</td>
				<td>特殊可选</td>
				<td>String</td>
				<td>20160806151343349021</td>
				<td>易支付订单号</td>
			</tr>
			<tr>
				<td>商户订单号</td>
				<td>out_trade_no</td>
				<td>特殊可选</td>
				<td>String</td>
				<td>20160806151343349</td>
				<td>订单支付时传入的商户订单号，商家自定义且保证商家系统中唯一</td>
			</tr>
			<tr>
				<td>退款金额</td>
				<td>money</td>
				<td>是</td>
				<td>String</td>
				<td>1.50</td>
				<td>少数通道需要与原订单金额一致</td>
			</tr>
		</tbody>
	</table>
	<p>注：trade_no、out_trade_no 不能同时为空，如果都传了以trade_no为准</p>
	<p>返回结果：</p>
	<table>
		<thead>
			<tr>
				<th>字段名</th>
				<th>变量名</th>
				<th>类型</th>
				<th>示例值</th>
				<th>描述</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td>返回状态码</td>
				<td>code</td>
				<td>Int</td>
				<td>1</td>
				<td>1为成功，其它值为失败</td>
			</tr>
			<tr>
				<td>返回信息</td>
				<td>msg</td>
				<td>String</td>
				<td>退款成功</td>
				<td></td>
			</tr>
		</tbody>
	</table>


	<!-- /MarkDown Content -->
</body>
<html>